#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
class Solution {
public:
    string reverseWords(string s) {
        size_t begin = 0;
        while (begin < s.size())
        {
            size_t end = s.find(' ', begin);
            reverse(s.begin() + begin, s.begin() + end);
            begin = end + 1;
        }
        return s;
    }
};

int main()
{
    string s("claus hello willkomm");
    Solution().reverseWords(s);

    return 0;
}